package com.loan.controller.app.over;

import com.loan.common.annotation.Log;
import com.loan.common.core.controller.BaseController;
import com.loan.common.core.domain.PageQuery;
import com.loan.common.core.domain.Result;
import com.loan.common.core.page.TableDataInfo;
import com.loan.common.enums.BusinessType;
import com.loan.system.domain.OverConfigEntity;
import com.loan.system.domain.OverWeightEntity;
import com.loan.system.service.OverWeightService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author shiguang on 2022/9/30 9:09
 */
@Validated
@Api(value = "催收权重配置", tags = {"催收权重配置"})
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/app/overWeight")
public class OverWeightController extends BaseController {

    private final OverWeightService overWeightService;

    @ApiOperation("获取催收权重列表")
    @GetMapping("/list")
    public Result<List<OverWeightEntity>> list(Long overId) {
        return Result.ok(overWeightService.list(overId));
    }

    @ApiOperation("新增或修改催收分配")
    @Log(title = "新增或修改催收分配", businessType = BusinessType.INSERT)
    @PostMapping("/saveOrUpdateOverWeight")
    public Result<Void> saveOrUpdateOverWeight(@RequestBody List<OverWeightEntity> list) {
        return toAjax(overWeightService.saveOrUpdateOverWeight(list));
    }

}
